/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ExceptionJPanel.java
 *
 * Created on 2009-3-24, 13:29:22
 */

package server.gui;

import config.Const;
import java.io.FileInputStream;
import java.io.FileReader;
import server.ServerController;
import tool.Tools;

/**
 *
 * @author liheyuan
 */
public class ExceptionJPanel extends javax.swing.JPanel {

    /**控制器*/
    ServerController controller = null;

    /** Creates new form ExceptionJPanel */
    public ExceptionJPanel(ServerController con) {
        initComponents();
        controller = con;
        loadExceptionFile();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel8 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jEditorPane1 = new javax.swing.JEditorPane();

        jLabel8.setFont(new java.awt.Font("宋体", 1, 16)); // NOI18N
        jLabel8.setText("今日异常信息");

        jButton1.setText("刷新");
        jButton1.setToolTipText("只会显示今日的异常");

        jEditorPane1.setBorder(null);
        jScrollPane1.setViewportView(jEditorPane1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 779, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addGap(18, 18, 18)
                        .addComponent(jButton1)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jButton1))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 369, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JEditorPane jEditorPane1;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables

    private void loadExceptionFile()
    {
        try
        {
            //今日的日志文件名
            String file = Const.EXCEPTION_PATH+Tools.getDate()+".log";
            //显示到文本区域中
            jEditorPane1.read(new FileInputStream(file), "Exception_LOG");
        }
        catch(Exception e)
        {
            
        }
    }
}
